package com.example.springcloud.rpc.api;

import java.util.StringJoiner;

/**
 * @author fanhang
 */
public class ErrorResult {
    private Integer code;
    private String message;

    public ErrorResult() {
    }

    private ErrorResult(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ErrorResult create(Integer code, String message) {
        return new ErrorResult(code, message);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", ErrorResult.class.getSimpleName() + "[", "]")
            .add("code=" + code)
            .add("message='" + message + "'")
            .toString();
    }
}
